﻿using System;
using Assist;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using HYView;
using TableTools.DataDefine;

namespace HYRElectric.MaterialStatistics
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdMaterialsStatistics : YJKCommandManual
	{
		protected override Result YJKExcute(ExternalCommandData cmdData, ref string message, ElementSet elements)
		{
			if (!(cmdData.Application.ActiveUIDocument.Document.ActiveView is ViewPlan))
			{
				Result result = SwitchView.SetUsableView((CmdViewType)3, cmdData);
				if (result != Result.Succeeded)
				{
					return result;
				}
			}
			StatisticsItems statisticsItems = new StatisticsItems(cmdData);
			return statisticsItems.YJKExcute(ref message, MaterialProgramInfos._Tag_TemplateType.TT_FAMILY, false);
		}
	}
}
